package com.youngwang.system;

/**
 * final  static 关键字测试
 *
 * @author youngwang
 *         Date: 2016/11/4
 */
public class PriceTest {
    public static void main(String[] args) {
        System.out.println(Price.INSTANCE.currentPrice);
       /* Price p = new Price(2.8);
        System.out.println(p.currentPrice);*/
    }
}

class Price {
    public static Price INSTANCE = new Price(2.8);
    public static final double initPrice = 20;
    double currentPrice;

    public Price(){
        System.out.println("Price 无参的构造器");
    }

    public Price(double discount){
        this();
        currentPrice = initPrice - discount;
    }
}
